package com.zyj.test.month1.day11;

/**
 * @author Yijia Zhang
 * @create 2024-05-18 11:33
 */
public class code2644 {
    public int maxDivScore(int[] nums, int[] divisors) {
        int res = Integer.MAX_VALUE;
        int num = 0;
        for (int i = 0; i < divisors.length; i++) {
            int di = divisors[i];
            int count = 0;
            for (int n : nums) {
                if (n % di == 0) {
                    count++;
                }
            }
            if (count >= num) {
                if (count == num) {
                    res = Math.min(res, di);
                } else {
                    res = di;
                }

                num = count;
            }
        }
        return res;
    }
}
